<template>
  <div>
    <FormPanel ref="from" :list="formList" :isSubmitBtn="false" :collapse="false" :labelWidth="110"></FormPanel>
    <div style="height: 47px"></div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right',
      }"
    >
      <el-button @click="closeDrawer(1)" :disabled="isSave">关 闭</el-button>
    </div>
  </div>
</template>
<script>
import { getCreateDealerInfo } from '@/api/omFinanceP/RebateManage/RebateInvoiceAudit';
import config from '@/assets/js/config';
import { dictionary } from '@/utils/dictMixin';
export default {
  data() {
    this.saveData = null;
    return {
      formList: this.createdFrom(),
      tableList: [],
      isSave: false,
      exportLoading: false,
    };
  },
  created() {
    this.createDealerInfo();
  },
  mounted() {},
  mixins: [dictionary],
  props: ['rowData'],
  methods: {
    async createDealerInfo() {
      let res = await getCreateDealerInfo(this.rowData);
      if (res.data) {
        for (let i in res.data) {
          this.formList.map((x) => {
            if (x.fieldName == i) {
              x.initialValue = res.data[i];
            }
          });
        }
      }
    },
    async closeDrawer(type) {
      if (type === 1) {
        this.$emit('close');
      }
    },
    createdFrom() {
      return [
        {
          type: 'BREAK_SPACE',
          label: '申请信息',
        },
        {
          type: 'INPUT',
          label: '返利红票申请单号',
          fieldName: 'applyNo',
          placeholder: '',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '经销商代码',
          fieldName: 'dealerCode',
          placeholder: '',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '经销商名称',
          fieldName: 'dealerName',
          disabled: true,
          placeholder: '',
        },
        {
          type: 'INPUT',
          label: '申请人',
          fieldName: 'applyPersonName',
          disabled: true,
          placeholder: '',
        },
        {
          type: 'INPUT',
          label: '申请时间',
          fieldName: 'applyDate',
          disabled: true,
          placeholder: '',
        },
        {
          type: 'SELECT',
          label: '状态',
          fieldName: 'applyStatus',
          disabled: true,
          placeholder: '',
          itemList: this.createDictList('2157'),
          initialValue: 21571001, // 默认新建
        },

        {
          type: 'INPUT_NUMBER',
          numberFormat: true,
          precision: 2,
          label: '返利可用余额',
          fieldName: 'rebateAvailableAmount',
          placeholder: '',
          disabled: true,
        },
        {
          type: 'INPUT_NUMBER',
          numberFormat: true,
          precision: 2,
          label: '返利冲红下限',
          fieldName: 'rebateRedLowLimitAmount',
          disabled: true,
        },
        {
          type: 'INPUT_NUMBER',
          numberFormat: true,
          precision: 2,
          placeholder: '',
          rules: [{ required: true, message: '请填写大于0的金额', trigger: 'change' }],
          label: '申请金额',
          disabled: true,
          fieldName: 'totalApplyAmount',
        },
        {
          type: 'INPUT',
          label: '审批报告编号',
          fieldName: 'auditReportNo',
          disabled: true,
          placeholder: '',
        },
        {
          type: 'TEXT_AREA',
          label: '申请原因',
          fieldName: 'applyReason',
          disabled: true,
          placeholder: '',
          selfCols: 2,
        },
        {
          type: 'UPLOAD_FILE',
          label: '相关文件',
          fieldName: 'applyUidList',
          disabled: true,
          selfCols: 2,
          upload: {
            actionUrl: `${config.uploadUrl}/api/file/oss/upload`,
            fileTypes: ['jpg', 'png', 'pdf', 'xls', 'xlsx', 'rar', 'zip'],
            limit: 5,
            tipText: '最多上传5个附件',
          },
        },
        {
          type: 'BREAK_SPACE',
          label: '审核信息',
        },
        {
          type: 'INPUT',
          label: '审核人',
          fieldName: 'checkPersonName',
          disabled: true,
          placeholder: '',
        },
        {
          type: 'INPUT',
          label: '审核日期',
          fieldName: 'checkDate',
          disabled: true,
          placeholder: '',
        },
        {
          type: 'TEXT_AREA',
          label: '审核意见',
          fieldName: 'checkDesc',
          disabled: true,
          placeholder: '',
          selfCols: 2,
        },
        {
          type: 'BREAK_SPACE',
          label: '发票信息',
        },
        {
          type: 'INPUT',
          label: '发票号',
          fieldName: 'sapInvoiceNo',
          disabled: true,
          placeholder: '',
        },
        {
          type: 'INPUT',
          label: '开票时间',
          fieldName: 'sapInvoiceDate',
          disabled: true,
          placeholder: '',
        },
        {
          type: 'INPUT_NUMBER',
          numberFormat: true,
          precision: 2,
          label: '开票金额',
          placeholder: '',
          fieldName: 'sapInvoiceAmount',
          disabled: true,
        },
      ];
    },
  },
};
</script>
